package cn.news.biz;


import org.apache.ibatis.session.SqlSession;

import cn.news.dao.RegisterDao;
import cn.news.entity.User;
import cn.news.util.SqlSessionFactoryUtil;

public class RegisterBiz {
	
	public boolean searchKey(String name){
		SqlSession session=SqlSessionFactoryUtil.getSqlsession();
		RegisterDao rDao=session.getMapper(RegisterDao.class);
		User us=rDao.searchKey(name);
		if(us.getUname()!=null){
			return true;
		}else{
			return false;
		}
	}
	public boolean addUser(User user){
		SqlSession session=SqlSessionFactoryUtil.getSqlsession();
		RegisterDao rDao=session.getMapper(RegisterDao.class);
		int flag=rDao.addUser(user);
		if(flag>0){
			return true;
		}else{
			return false;
		}
	}
}
